<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="userRoleDisplay" value="消费者"/>
<c:set var="userNameDisplay" value="${not empty sessionScope.user ? sessionScope.user.username : ''}"/>
<%-- 消费者公共导航栏 --%>
<div class="navbar">
    <a href="${pageContext.request.contextPath}/consumer/index">首页</a>
    <a href="${pageContext.request.contextPath}/consumer/traceability">溯源查询</a>
    <a href="#">在线客服</a>
    <a href="${pageContext.request.contextPath}/consumer/personal" class="right">个人中心</a>
    <a href="${pageContext.request.contextPath}/consumer/message" class="right">消息中心</a>
    <a href="${pageContext.request.contextPath}/logout" class="right" onclick="return confirmLogout('${userRoleDisplay}', '${userNameDisplay}');">退出登录</a>
</div>
<script>
function confirmLogout(role, username) {
    return confirm(role + (username ? ' ' + username : '') + '，是否退出登录？');
}
</script>